package com.shsappdev.shsfalconbeta;

import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;
import com.shsappdev.shsfalconbeta.article.Article;

import android.support.v4.app.Fragment;
import android.os.Bundle;

public class ArticleViewerActivity extends SherlockFragmentActivity {
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Article article = (Article)getIntent().getExtras().getSerializable("article");
		setContentView(R.layout.activity_fragment_holder);
		Bundle args = new Bundle();
        args.putSerializable("article", article);
        Fragment fragment = new ArticleViewerFragment();
        fragment.setArguments(args);
        getSupportFragmentManager().beginTransaction()
        .replace(R.id.main, fragment)
        .commit();
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			finish();
			break;
		}
		return true;
	}
	
	@Override
	public void onResume() {
		super.onResume();
	}
	
}
